package p.ithorns.framework.common.future;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * FutureHolder
 * TODO
 *
 * @author ithorns
 * @version 1.0
 * @date 2021/12/11 21:26
 */
public class FutureHolder {

    private final static Map<Command, SyncFuture<?>> FUTURES = new ConcurrentHashMap<>();

    public static <V> void put(Command cmd, SyncFuture<V> future) {
        FUTURES.put(cmd, future);
    }

    public static <V>  SyncFuture<V> get(Command cmd) {
        return (SyncFuture<V>) FUTURES.get(cmd);
    }
}
